package com.leo.tool.execl;

import com.leo.tool.http.HttpParamers;
import com.leo.tool.http.HttpService;
import org.junit.Ignore;
import org.junit.Test;

import java.io.OutputStream;
import java.util.List;

public class ExcelDemo {


//    @Ignore("暂时忽略")
//    @Test
//    public void test1(HttpServletResponse response) {
//
//        //给文件命名。随机命名
//        String fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls";
//        //告诉浏览器数据格式，将头和数据传到前台
//        String headStr = "attachment; filename=\"" + fileName + "\"";
//        response.setContentType("APPLICATION/OCTET-STREAM");
//        response.setHeader("Content-Disposition", headStr);
//        OutputStream out = response.getOutputStream();
//
//        // 操作导出excel
//        List<OutInfo> dataList = outInfoService.list();
//        //excel标题
//        String title = "平台违规信息2020-10-12";
//        //excel列头信息
//        String[] rowsName = new String[]{"测试列表"};
//
//        //调用poi的工具类
//        ExportExcel ex = new ExportExcel(title, rowsName, HAUtils.objToList(dataList));
//        try {
//            ex.export(out);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        out.flush();
//        out.close();
//    }

}
